package com.pronhub.cloud.shop.alipay;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 相关的文件配置 需要从码云上注入下来 然后注入到相关的类里面进行读取
 */
@Configuration
public class AlipayConfig {

    @Bean
    public AlipayClient alipayClient(AlipayProperties alipayProperties){
        /**
         * 网关的Id
         */
        return new DefaultAlipayClient(alipayProperties.getGatewayUrl(), alipayProperties.getAppId(), alipayProperties.getMerchantPrivateKey(), "json", alipayProperties.getCharset(), alipayProperties.getAlipayPublicKey(), alipayProperties.getSignType());
    }
}
